<?php

namespace app\communal\controller;

use app\Param;
use app\model\Express as ModelExpress;
use think\Db;


class Express extends Param
{
    public function _initialize()
    {
        parent::_initialize();
    }


    /*
     * 快递公司列表
     * URI：/communal/express.list
     */
    public function expressList()
    {
        $expressName = $this->_getContentParams('expressName');

        if ($expressName){
            $where = [
                'express_name' => ['like','%'.$expressName.'%'],
            ];
        }else{
            $where = [];
        }

        $arr_list = ModelExpress::getInstance()->toSelect($where, 'express_id AS expressId,express_name AS expressName,express_logo AS expressLogo');
//        echo Db::name('express')->getLastSql();
        _returnData(['expressList' => $arr_list]);
    }

}
